package suncertify.ui;

import java.rmi.Remote;
import java.rmi.RemoteException;

/**
 * A Common interface for any object that needs to subscribe to the application's
 * remote database.  This interface uses the principles of the Observer pattern.
 * @author Paul Wilhelm
 *
 */
public interface Subscriber extends Remote{
	
	/**
	 * Updates the particular view to refresh any data that might be out of sync.
	 * @param requestorName - The name of the room requesting changes on the DB
	 * @param requestorLocation - The location of room requesting changes to the DB
	 * @throws RemoteException
	 */
	public void update(String requestorName, String requestorLocation) throws RemoteException;
	
	/**
	 * Subscribes the passed object to the DB in order to be notified of DB changes.
	 * @param s - The Subscriber object to send to the remote DB (usually the object calling the method). 
	 * @throws RemoteException
	 */
	public void subscribeToChanges(Subscriber s) throws RemoteException;
	
	/**
	 * Gets the name of the room for the <code>Subscriber</code> object.
	 * @return The name of the room for the object
	 * @throws RemoteException
	 */
	public String getName() throws RemoteException;
	
	/**
	 * Gets the location of the room for the <code>Subscriber</code> object
	 * @return The location of the room for the object
	 * @throws RemoteException
	 */
	public String getLocation() throws RemoteException;
	
	/**
	 * Gets the title of the window for the <code>Subscriber</code> object
	 * @return The title of the window for the <code>Subscriber</code> object.
	 * @throws RemoteException
	 */
	public String getTitle() throws RemoteException;

}
